package cc.lucien.service;

import cc.lucien.entity.Order;
import cc.lucien.repository.OrderRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderService {

    @Autowired
    private OrderRepository orderRepository;

    public List<Order> findAll() {
        return orderRepository.findAll();
    }

    public Order findById(Integer id) {
        return orderRepository.findById(id);
    }

    public Order findByCompanyName(String companyName) {
        return orderRepository.findByCompanyName(companyName);
    }

    public int save(Order order) {
        return orderRepository.save(order);
    }

    public int update(Order order) {
        return orderRepository.update(order);
    }

    public int deleteById(Integer id) {
        return orderRepository.deleteById(id);
    }
}
